<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="renderer" content="webkit|ie-comp|ie-stand">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <title>代码生成器</title>
  <script src="../../static/kaige/js/szload.js"></script>
  <style>
    .curdtag {
      min-width: 150px;
      height: 28px;
      line-height: 28px;
      padding: 3px 5px 3px 6px;
      margin-bottom: 10px;
      overflow: auto;
    }
  </style>
</head>

<body>
  <div class="kaige-body kaige-btn-radius">
    <table class="layui-table" id="pageTable" lay-filter="pageTable" lay-size="sm"></table>
  </div>

  <script>
    load_init_js(function () {
      layui.config({
        base: szoapcpath + '/static/kaige/layuiextend/'
      }).use(['kaige'], function () {
        var element = layui.element,
          layer = layui.layer,
          table = layui.table,
          form = layui.form,
          kaige = layui.kaige,
          $ = layui.$;

        kaige.table({
          elem: '#pageTable',
          url: "/makecode/index",
          id: 'pageTable',
          page: false,
          height: 'full-30',
          cols: [[
            { type: 'numbers', title: '序号' }
            , { field: 'table_name', title: '表名', sort: true, width: 300 }
            , { field: 'comment', title: '备注', width: 300 }
            , { field: 'iscz', title: '是否存在', sort: true, width: 120, templet: function (d) { return yesno2tag(d.iscz) } }
            , { title: '操作', toolbar: '#dtrbar', align: 'center', width: 100, fixed: 'right' }
          ]],
          done: function (res, curr, count) {

          }
        });

        //列表-监听单元格行工具事件dtrbar
        table.on('tool(pageTable)', function (obj) {
          var data = obj.data;
          switch (obj.event) {
            case 'del':
              bardel(data,obj);
              break;
          }
        });

        //删除
        function bardel(d,obj) {
          layer.confirm('您确定删除吗？', {
            title: '<i class="layui-icon layui-icon-delete"></i> 删除确认',
            btn: ['确认', '取消']
          }, function () {
            $.post("/makecode/del", { id: d.id }, function (res) {
              layer.msg(res.msg);
              obj.del();
            });
          });
        };

      });
    });
  </script>
  <script type="text/html" id="dtrbar">
    <div class="layui-btn-group">
        {{# if(d.iscz != 1){ }}
        <button class="layui-btn layui-btn-sm layui-bg-red" lay-event="del" title="删除"><i class="layui-icon layui-icon-delete"></i></button>
        {{# } }}
    </div>
  </script>
</body>

</html>